import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import 'amfe-flexible'
import {
  NavBar, Form, Field,
  Button, Search, Tabbar,
  TabbarItem, Tab, Tabs, IndexBar,
  IndexAnchor, Swipe, SwipeItem,
  Icon, SwipeCell, Card, Tag,
  DropdownMenu, DropdownItem,
  ActionSheet, Sticky, Col, Row,
  Grid, GridItem, TreeSelect,
  Picker, Popup, Cell, Switch
  , Panel
  , Image as VanImage
  , List
  , PullRefresh
  , AddressEdit, CellGroup
  , Uploader
  , Toast
} from 'vant'
import hljs from 'highlight.js' // hljs对象
import 'highlight.js/styles/default.css'

import BaiduMap from 'vue-baidu-map'

Vue.use(Toast)
Vue.use(Uploader)
Vue.use(CellGroup)
Vue.use(AddressEdit)
Vue.use(PullRefresh)
Vue.use(List)
Vue.use(VanImage)
Vue.use(Panel)
Vue.use(Picker)
Vue.use(Popup)
Vue.use(Cell)
Vue.use(Switch)
Vue.use(TreeSelect)
Vue.use(Grid)
Vue.use(GridItem)
Vue.use(Col)
Vue.use(Row)
Vue.use(Sticky)
Vue.use(ActionSheet)
Vue.use(DropdownMenu)
Vue.use(DropdownItem)
Vue.use(SwipeCell)
Vue.use(Icon)
Vue.use(Card)
Vue.use(Tag)
Vue.use(Swipe)
Vue.use(SwipeItem)
Vue.use(IndexBar)
Vue.use(IndexAnchor)
Vue.use(Tab)
Vue.use(Tabs)
Vue.use(Tabbar)
Vue.use(TabbarItem)
Vue.use(Search)
Vue.use(Button)
Vue.use(Form)
Vue.use(Field)
Vue.use(NavBar)
Vue.config.productionTip = false // 代码高亮的样式
new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

Vue.directive('highlight', function (el) { // 自定义一个代码高亮指令
  const highlight = el.querySelectorAll('pre, code') // 获取里面所有pre或者code标签
  highlight.forEach((block) => {
    hljs.highlightElement(block) // 突出显示这些标签(以及内部代码, 会自动识别语言)
  })
})

Vue.use(BaiduMap, {
  // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
  ak: 'YxXNc3f8NsL4Ws6QtRzrY1F9jCXYfycn'
})
